package per.kongtouxu.Util;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import per.kongtouxu.domain.pojo.Admin;
import per.kongtouxu.domain.pojo.AdminLog;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;

public class CommonMethod {
    //获取后台日志
    public static AdminLog getAdminLog(HttpServletRequest req){
        //2.1获取adminId
        Admin loginAdmin =(Admin) req.getSession().getAttribute("loginAdmin");
        Long adminId = loginAdmin.getAdminId();
        Integer LoginId = Math.toIntExact(adminId);
        //3.编写日志类
        AdminLog adminLog = new AdminLog();
        adminLog.setAdminId(LoginId);

        return adminLog;
    }

}
